/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package operacionesDB;
import control.controlLibro;
import gestion.DBgestionLibros;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import negocio.Libro;
/**
 *
 * @author Luis Felipe Gomez
 */
public class connectionDB {
    
public String bd = "pretamolibros";
public String login = "root";
public String password = "";
public String url = "jdbc:mysql://localhost/"+bd;
Connection conn ; 

public Connection conectar() {
conn = null;
try {
Class.forName("org.gjt.mm.mysql.Driver");
conn = DriverManager.getConnection(url, login, password);


}
catch(SQLException ex) {
System.out.println("Hubo un problema al intentar conectarse con la base de datos "+url);
}
catch(ClassNotFoundException ex) {
System.out.println(ex);
}
return conn;

}
public void cerrarConection(){
        try {
            conn.close();
        } catch (SQLException ex) {
            Logger.getLogger(connectionDB.class.getName()).log(Level.SEVERE, null, ex);
        }
}
public static void main (String [] args ){
 
   
 
   
   
 
 
}
}

